<?php

namespace Common\TagLib;
use Think\Template\TagLib;
/**
*   前台导航自定义标签
*/
class Channel extends TagLib
{
	
	// 标签定义
    protected $tags   =  array(
    	'nav' => array('attr' => 'limit,order'),
    );

    public function _nav( $tag, $content) {
    	$str = <<<str
<?php
    \$cate = M('Channel')->order("{$tag['order']} asc,`id` asc")->limit({$tag['limit']})->select();
    \$Category = new \Common\Api\Category();
    \$cate = \$Category->unlimitedForLayer(\$cate);
    foreach (\$cate as \$v) :
?>
str;
        $str .= $content;
        $str .= "<?php endforeach; ?>";
        return $str;
    }
}